#include "icebearledwidget.h"
#include "ui_icebearledwidget.h"
#include "keyboard.h"
IceBearLedWidget::IceBearLedWidget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::IceBearLedWidget)
{
    ui->setupUi(this);
    myEvent = new fsmpEvents;
    infrared = new fsmpProximity;
    if (sled){
        sled = new fsmpSevensegLed;
        sled->start();
        qDebug()<< "new sled";
    }
    localService();
    onlineService();
    keyboard = new KeyBoard();
    ui->numLineEdit->installEventFilter(keyboard);
}

IceBearLedWidget::~IceBearLedWidget()
{
    timer->stop();
//    sled->~fsmpSevensegLed();
    delete ui;
}




void IceBearLedWidget::on_ledButton_clicked()
{
    int num = ui->numLineEdit->text().toInt();
    if(num>0 && num<9999)
    {
        sled->display(num);
    }
    else
    {
        sled->display("eeee");
    }

}


void IceBearLedWidget::on_backButton_clicked()
{
//    sled->stop();
//    sled->quit();
//    sled->wait();
    timer->stop();
//    delete sled;
    this->hide();

}

